public class ModCalc {
    public static void main(String[] args){
        int num = -10;//若num为负数，取模结果加负号

        System.out.println(num % 2);
        System.out.println(num % -3);//模 -3 等同于 模 3
        System.out.println(num % 4);
        System.out.println(num % 5);
        System.out.println(num % -6);
    }
}
